<div class="biaotbody" style="margin-top:8px;">
        <table>
            <tr>
                <th class="li4">
                    <div class="lijz">id</div>
                </th>
                <th class="li15">
                    <div class="lileft">链接</div>
                </th>                
                <th class="li5">
                     <div class="lileft">来源</div>
                </th>
                <th class="li6">
                     <div class="lileft">媒体</div>
                </th>                
                <th class="li4">
                    <div class="lileft">code</div>
                </th>
                <th class="li15">
                    <div class="lileft">标题</div>
                </th>
                <th class="li6">
                     <div class="liright">操作</div>
                </th>
            </tr>            
        </table>
    </div>
    <div class="table">
          <table>
              <?php foreach($this->list as $item){ ?>
              <tr>
                     <td class="li4">
                         <div class="lijz"><?php echo $item->Id; ?></div>
                     </td>
                     <td class="li15">
                         <div class="lileft"><?php echo $item->Target?$item->Target:""; ?></div>
                     </td>                    
                     <td class="li5">
                        <div class="lileft"><?php echo $item->Source?$item->Source:""; ?></div>
                     </td>
                     <td class="li6">
                          <div class="lileft"><?php echo $item->Media?$item->Media:""; ?></div>
                     </td>                    
                     <td class="li4">
                         <div class="lileft"><?php echo $item->Code?$item->Code:""; ?></div>
                     </td>
                     <td class="li15">
                         <div class="lileft">
                            <?php echo $item->FormatTitle?$item->FormatTitle:""; ?>         
                         </div>
                     </td>
                     <td class="li6">
                        <div class="lixlnav">
                        <a class="xlnavxq" href="/admini/system/linkdetail/id/<?php echo $item->Id; ?>">详情</a>
                        <div class="xlnavlistbox">
                                <a class="xlnavsj" href="javascript:void(0);"><i></i></a>
                            <div class="xlnavlist" style="display:none;">
                                <ul>
                                        <li><a href="javascript:edit(<?php echo $item->Id; ?>);">编辑</a></li>
                                        <li><a href="javascript:del(<?php echo $item->Id; ?>)">删除</a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                     </td>
             </tr>
              <?php } ?>
       </table>
   </div>

<div class="tanchuang" style="display:none;width:780px;height:580px;">
    <div class="nui-msgbox">
        <div class="nui-msgbox-hd" id="wayProblem">添加推广链接</div>
        <a class="nui-msgbox-close" title="关闭"><b></b></a>
    </div>
    <div class="wenti_box" id="problemComm">
                <table id="add_table" style="margin-top:32px;">
                    <input type="hidden" id="alid" name="alid" value=""/>
                    <tr height="42px;">
                        <td align="right" width="100px;">名称：</td>
                        <td colspan="3"><input type="text" id="name" name="name" value="" style="width:600px;"/></td>
                    </tr>
                    <tr height="42px;">
                        <td align="right" width="100px;">链接：</td>
                        <td colspan="3"><input type="text" id="target" name="target" value="" style="width:600px;"/></td>
                    </tr>
                    <tr height="42px;">
                        <td align="right" width="100px;">来源：</td>
                        <td colspan="3"><input type="text" id="source" name="source" value="" style="width:600px;"/></td>
                    </tr>
                    <tr height="42px;">
                        <td align="right" width="100px;">媒体：</td>
                        <td colspan="3"><input type="text" id="media" name="media" value="" style="width:600px;"/></td>
                    </tr>
                    <tr height="42px;">
                        <td align="right" width="100px;">活动：</td>
                        <td colspan="3"><input type="text" id="campaign" name="campaign" value="" style="width:600px;"/></td>
                    </tr>
                    <tr height="42px;">
                        <td align="right" width="100px;">描述：</td>
                        <td colspan="3"><input type="text" id="description" name="description" value="" style="width:600px;"/></td>
                    </tr>
                    <tr height="42px;">
                        <td align="right" width="100px;">code：</td>
                        <td colspan="3"><input type="text" id="code" name="code" value="" style="width:600px;"/></td>
                    </tr>
                    <tr height="42px;">
                        <td align="right" width="100px;">标题：</td>
                        <td colspan="3"><input type="text" id="title" name="title" value="" style="width:600px;"/></td>
                    </tr>
                    <tr height="42px;">
                        <td align="right" width="100px;">内容：</td>
                        <td colspan="3"><input type="text" id="content" name="content" value="" style="width:600px;"/></td>
                    </tr>
                </table>
                <div class="qunx" style="margin-left:300px;margin-top: 32px;">
                    <ul>
                        <li><a class="anvbotton" href="javascript:goSubmit();"><span>确定添加</span></a></li>
                    </ul>
                </div>
    </div>
</div>
<div class="houtai_overlay" style="display:none;"></div>

<div class="toolbar" <?php if(empty($this->list))  echo "style='display: none'"; ?>>
        <?php echo $this->partial('paging.phtml', array("pages" => $this->result)); ?>
</div>

<div class="qunx" style="margin-left: 32px;">
    <ul>
        <li><a class="anvbotton" href="javascript:addLink();"><span>添加推广链接</span></a></li>
    </ul>
</div>


<script type="text/javascript">
    $(".xlnavsj").live("mousemove",function(){
        $(this).next("div").attr("style","display:block;");
    });
    $(".lixlnav").mouseleave(function(){
        $(".xlnavsj").next("div").attr("style","display:none;");
    }); 
    
    function addLink(){
        $('.tanchuang').show("");
        $('.houtai_overlay').show("");
        $('#name').val("");
        $('#target').val("");
        $('#source').val("");
        $('#media').val("");
        $('#campaign').val("");
        $('#description').val("");
        $('#code').val("");
        $('#title').val("");
        $('#content').val("");
    }
    
    $(".nui-msgbox-close").click(function(){
        $(".houtai_overlay").hide();
        $(".tanchuang").hide();
    });
    
    function goSubmit(){
        if(confirm("确定要提交？")){
            var alid = $('#alid').val();
            var name = $('#name').val();
            var target = $('#target').val();
            var source = $('#source').val();
            var media = $('#media').val();
            var campaign = $('#campaign').val();
            var description = $('#description').val();
            var code = $('#code').val();
            var title = $('#title').val();
            var content = $('#content').val();
            $.post(
                '/admini/system/increaselink',
                {'name':name,'target':target,'source':source,'media':media,'campaign':campaign,'description':description,'code':code,'title':title,'content':content,'alid':alid},
                function (data){
                    if(data === 1){
                        alert("添加成功！");
                        window.location.reload();
                    }else if(data === 2){
                        alert("修改成功！");
                        window.location.reload();
                    }else{
                        alert("操作失败！");
                    }
                }
            ,'json');
        }        
    } 
    
    function edit(id){
        $.post(
            '/admini/system/getadlink',
            {'id':id},
            function (data){
                $('#alid').val(data.alid);
                $("#name").val(data.name);
                $('#target').val(data.target);
                $('#source').val(data.source);
                $('#media').val(data.media);
                $('#campaign').val(data.campaign);
                $('#description').val(data.description);
                $('#code').val(data.code);
                $('#title').val(data.title);
                $('#content').val(data.content);
                $('.tanchuang').show();
                $('.houtai_overlay').show();
            }
        ,'json')
    }
    
    function del(id){
        if(confirm("确定要删除？")){
            $.post(
                '/admini/system/deladlink',
                {'id':id},
                function (data){
                    if(data === 1){
                        alert("删除成功！");
                        window.location.reload();
                    }else{
                        alert("删除失败！");
                    }
                }
            );
        }
    }
    
    
    
</script>





